import { Indicator } from "./Indicator.js"
import { Net } from "./Net.js"


export class Main {
    constructor() {
        // alert('123123')

        this.ind = new Indicator()
        this.net = new Net(this)
        this.globalFunc()
        this.stopForm()
        
        // this._ind.show = true
    }

    globalFunc() {
        window.getUrl = async (url, data) => {
            await this.net.ajax(url, data)
            window.location.reload()
        }
    }

    stopForm() {
        const arr = document.querySelectorAll('form.nosubmit')
        for (let o of arr) {
            o.onsubmit = () => {
                // console.log('submit', o)
                this.net.submit(o)
                return false
            }
        }
    }  // stopForm


}


new Main()